function [timeslots,ofv] = cdlp2(os,RS,capcon,cap,Qt,nTimeperiods,products)
ossz = size(os);
prob = optimproblem('ObjectiveSense','maximize');
t = optimvar('t',ossz(1),'Type','continuous','LowerBound',0,'UpperBound',nTimeperiods);
prob.Objective = sum(sum(RS,2).*t);
capconstraint1 = sum(Qt*capcon(:,1).*t) <= cap(1);
capconstraint2 = sum(Qt*capcon(:,2).*t) <= cap(2);
capconstraint3 = sum(Qt*capcon(:,3).*t) <= cap(3);
timeconstraint = sum(t) <= nTimeperiods;
prob.Constraints.cap1 = capconstraint1;
prob.Constraints.cap2 = capconstraint2;
prob.Constraints.cap3 = capconstraint3;
prob.Constraints.tim = timeconstraint;
[sol,ofv] = solve(prob);
timeslots = sol.t;